package com.fxnotes.domain.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class Book extends NamedEntity {

    private List<Chapter> chapters = new ArrayList<>();

    public Book(String name) {
        super(name);
    }

    public List<Chapter> getChapters() {
        return chapters;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Book) {
            Book that = (Book) obj;
            return Objects.equals(this.getName(), that.getName());

        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }

    @Override
    public String toString() {
        return name;
    }
}
